package com.lq.demo.demo.mode.websocket;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;

@Controller
@RequestMapping("/index")
public class RouteController {


//    @Autowired
//    private WebSocketServer webSocketServer;

    @Autowired
    private MessageWebSocketHandler handler;

    @GetMapping("/demo")
    public String index() {
        return "demo";
    }

    @GetMapping("/send")
    @ResponseBody
    public String send() throws IOException {
        handler.send();
//        webSocketServer.sendMsg("test");
        return "success";
    }
}
